Phase 46: intake→completion e2e test (KI-016 O, demo spine) + CI Postgres job#261
Phase 46: intake→completion e2e test (KI-016 O, demo spine) + CI Postgres job#261RJK134 wants to merge 5 commits into
Conversation
Add a self-contained real-database end-to-end test that drives the whole demo spine through the actual domain services (no @/lib/prisma or @/lib/env mocks): intake → auto-triage → route proposal → vet approval → booking → confirmation → completion → follow-up regeneration - __tests__/e2e/intake-to-completion.test.ts: two tests — the full spine (asserting every status hand-off + follow-up regen) and the URGENT → automationHold path (held out of proposals). Seeds e2e- fixtures in beforeAll, hard-deletes them child-first in afterAll (idempotent / re-runnable). Gated by describe.skipIf(!RUN_DB_E2E). - __tests__/e2e/setup.ts: requires a real DATABASE_URL; fails fast if RUN_DB_E2E is set but it's the unit stub. Does NOT stub the URL. - vitest.e2e.config.ts: includes ONLY __tests__/e2e/**, node env, the e2e setup file, single-threaded, generous timeouts. - vitest.config.ts: exclude __tests__/e2e/** so npm run test (the 2,835 mocked unit tests) never imports the real-DB suite. - package.json: add test:e2e script. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
Additive new job `e2e` (needs: check) that spins up a postgres:16 service container, applies migrations with `prisma migrate deploy`, then runs `RUN_DB_E2E=1 DEMO_MODE=true npm run test:e2e` against the real service DB (distinct DATABASE_URL from the stub the `check` job uses). The `check`, `docker`, and `security` jobs are untouched; `docker` still gates on `check` only, so the existing unit/lint/build path is unaffected. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
- docs/PHASE_46_KI_016_O_DEMO_WALKTHROUGH.md: rehearsed UI demo script walking the same spine in demo mode, with the 3 intentional vet gates. - docs/KNOWN_ISSUES.md: add KI-031 (confirmation 24h-window check is DEMO-only / TODO(prod) in confirmation.service shouldUseTemplate(), Meta-gated, deferred); mark KI-016 O delivered; update the KI-016 row. - .claude/memory.md: session notes (real status-transition map, the fixture constraints to reach a proposal, e2e plumbing, CI split). https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 34021120 | Triggered | Generic Password | f95bd40 | .github/workflows/ci.yml | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b299f61. Configure here.
| - run: npm run test -- --passWithNoTests | ||
| - run: npm run build | ||
|
|
||
| # Phase 46 — KI-016 O: real-database end-to-end "demo spine" test. |
There was a problem hiding this comment.
CI paths skip e2e tests
Medium Severity
The new e2e job only runs when the check job runs, but pull_request uses a paths filter that omits __tests__/**, vitest.config.ts, and vitest.e2e.config.ts. PRs that change only the real-database e2e suite (or Vitest split) skip the whole workflow, so the demo-spine test never runs in review despite the PR promising CI coverage.
Reviewed by Cursor Bugbot for commit b299f61. Configure here.
GitGuardian flagged POSTGRES_PASSWORD=equismile_ci_pw on #261. It is an ephemeral CI service-container password (throwaway DB, job-lifetime only), not a real secret — but GitGuardian is a merge gate. Switch the e2e service to the same test:test convention the check job's stub already uses so the detector stops keying on it. No behaviour change. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
The pull_request paths filter omitted __tests__/** and the vitest configs, so a PR touching only the e2e suite (or the unit/e2e split) would skip the whole workflow — the e2e job would never run despite the PR promising CI coverage. Add __tests__/**, vitest.config.ts and vitest.e2e.config.ts to the trigger paths. Also tightens coverage for the existing check job's unit tests. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
|
Superseded by #263 — identical content, rebuilt as a single clean commit so no intermediate commit carries the ephemeral CI Postgres password GitGuardian flagged (it was never a real secret — a throwaway service-container password). The real gates here were all green ( Generated by Claude Code |
* docs: refresh current-state to Phase 46 (KI-016 O merged in #263) - CLAUDE.md current-state header: add the Phase 46 bullet (intake→completion e2e demo-spine + CI Postgres job, KI-031), bump phase history 0–45 → 0–46 and the KI range to KI-031; correct the Phase 45 bullet to merged (#260). - docs/BUILD_PLAN.md: add the Phase 46 entry (scope, the no-integration-bug finding, the three corrected status-map facts, verification, #261→#263). - .claude/memory.md: capture the GitGuardian-ephemeral-CI-cred lesson and the clean-history rebuild workaround (merge --squash → fresh branch/PR) used to clear it when the git-proxy blocks force-push. Docs only; no code or schema. Final merge left to Richard / Freddie. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv * docs: describe the flagged CI value instead of quoting it (Bugbot #264) The GitGuardian lesson bullet quoted the literal old POSTGRES_PASSWORD value, which would let GitGuardian re-flag it on this very PR — the exact loop the #263 rebuild closed. Describe the value instead of pasting it. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv --------- Co-authored-by: Claude <noreply@anthropic.com>
The self-built 'BugBot PR Review' check in claude-code-review.yml has been failing identically on every recent PR (#261/#263/#266/#267) with an internal 'directory mismatch for directory ".../tsconfig.json" ... this indicates a bug. You don't need to do anything' error in the post- buffered-inline-comments step — it crashes ~20s in, regardless of PR content. The recurring spurious red obscures the real merge gates. Root cause: this workflow pinned anthropics/claude-code-action to an older v1.0 commit (1dc994ee, 2026-06) whose internal action.yml step has the bug. Bump to 51ea8ea7 (refs/tags/v1, the same SHA the sibling claude.yml workflow already uses), which clears the crash. Other workflows (claude.yml, claude-code-fix.yml) are unaffected — they already use 51ea8ea7 / @v1. Real merge gates (check/docker/security/ e2e/GitGuardian) and the substantive AI reviewer (Cursor Bugbot) are untouched. https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv Co-authored-by: Claude <noreply@anthropic.com>


Phase 46 — KI-016 O: full intake→completion e2e ("demo spine")
The long-deferred KI-016 O. The investigation confirmed the pipeline is already fully wired (zero product-code changes needed), so this is a test + CI-infra + docs deliverable that proves the whole spine connects under real data and keeps it from regressing.
What it does
__tests__/e2e/intake-to-completion.test.tsdrives the real domain services (no Prisma/env mocks) against a freshly-migrated Postgres, asserting every status hand-off across the pipeline:intake (processWhatsAppPayload) → auto-triage → route proposal → vet approval → booking → confirmation → completion → follow-up regenerationwith exact transition assertions at each seam (
PLANNING_POOL → CLUSTERED → APPROVED → BOOKED, AppointmentPROPOSED → CONFIRMED → COMPLETED,ConfirmationDispatchaudit row,AppointmentStatusHistoryrows, and the regeneratedFOLLOW_UPVisitRequest back inPLANNING_POOL). A second test covers the URGENT →automationHoldexclusion path (held out of all proposals until a vet clears it). Self-containede2e-fixtures with child-first cleanup → idempotent.How it runs (the one sensitive change — please eyeball the CI diff)
vitest.e2e.config.ts(includes only__tests__/e2e/**); the defaultvitest.config.tsnow excludes that dir, so the 2,835-test unit suite never touches a real DB. Scriptnpm run test:e2e.RUN_DB_E2E— without it the suite skips, so localnpm run testand any non-DB runner stay green.e2ejob in.github/workflows/ci.yml—needs: check, apostgres:16service container,prisma migrate deploy, thennpm run test:e2e. It does not touch the existingcheck/docker/securitygates (action SHAs match them). It adds a new check (~1–2 min + a Postgres spin-up) on PRs.Findings (the real prize)
No integration bug — the spine is correct. Three inaccuracies in the original map were corrected in the test (real product behaviour): the VisitRequest ends route-proposal at
CLUSTERED(there is noPROPOSEDplanningStatus; PROPOSED is an Appointment status);bookRouteRunhard-requiresRouteRun.status === 'APPROVED', i.e. there's a genuine vet-approval gate before booking; and a lone yard only yields a proposal at ≥3 horses (clustering threshold).One genuine deferred gap logged as KI-031:
confirmation.service.tsshouldUseTemplate()only does the 24h-window check in demo mode (TODO(prod)) — Meta-gated, harmless until live WhatsApp, but a real loose end to wire when Meta verification lands.Verification (independently re-run on this branch)
npm run test:e2e→ 2 passed against real Postgres; re-run idempotent (zeroe2e-residue).npm run test→ 279 files / 2,835 passed, e2e dir excluded. lint ✓ typecheck ✓ prisma validate ✓ build ✓.Docs:
docs/PHASE_46_KI_016_O_DEMO_WALKTHROUGH.md(rehearsed UI demo script + the 3 intentional vet gates); KNOWN_ISSUES updated (KI-016 O delivered, KI-031 added). No schema change, no migration.Final merge left to Richard / Freddie.
https://claude.ai/code/session_01VzJJTUcvzZgS9jN8aap9iv
Generated by Claude Code